extends TileMapLayer

var astar:= AStarGrid2D.new()

# Called when the node enters the scene tree for the first time.
func _ready() -> void:
	astar.region = get_used_rect()
	astar.cell_size = self.tile_set.tile_size
	astar.default_compute_heuristic = AStarGrid2D.HEURISTIC_CHEBYSHEV
	astar.default_estimate_heuristic = AStarGrid2D.HEURISTIC_CHEBYSHEV
	astar.diagonal_mode = AStarGrid2D.DIAGONAL_MODE_NEVER
	astar.update()
	for x in range(astar.region.position.x,astar.region.end.x):
		for y in range(astar.region.position.y,astar.region.end.y):
			var coord = Vector2i(x,y)
			if self.get_cell_source_id(coord)!= -1:
				print("坐标", coord, "上刷上了图块")
			else:
				print("坐标", coord, "上没有刷上图块")
				astar.set_point_solid(coord)


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
	pass
